package ru.nsu.expertsystem.chucknorris;

public class Affraid implements Predicate {
	private Object what;
	private Object of;

	public Affraid() {
		
	}
	
	public Affraid(Object what, Object of) {
		this.setWhat(what);
		this.setOf(of);
	}

	/**
	 * @return the what
	 */
	public Object getWhat() {
		return what;
	}

	/**
	 * @param what the what to set
	 */
	public void setWhat(Object what) {
		this.what = what;
	}

	/**
	 * @return the of
	 */
	public Object getOf() {
		return of;
	}

	/**
	 * @param of the of to set
	 */
	public void setOf(Object of) {
		this.of = of;
	}
	
	@Override
	public String toString() {
		return String.format(IMessages.AffraidMessage, what, of);
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((of == null) ? 0 : of.hashCode());
		result = prime * result + ((what == null) ? 0 : what.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(java.lang.Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Affraid other = (Affraid) obj;
		if (of == null) {
			if (other.of != null)
				return false;
		} else if (!of.equals(other.of))
			return false;
		if (what == null) {
			if (other.what != null)
				return false;
		} else if (!what.equals(other.what))
			return false;
		return true;
	}
	
}
